package com.mic.core.model.page;


public class PageUtils {
	
	public static Integer computeTotalPage(Integer totalCount, Integer pageCount) {
		if (totalCount == 0)
			return 0;
		return (totalCount - 1) / pageCount + 1;
	}

	public static Integer getLegalCurrentPage(Integer totalPage,
			Integer currentPage) {
		if (currentPage == null)
			return 1;
		if (currentPage < 1 || currentPage > totalPage)
			return 1;
		return currentPage;
	}
	
}
